﻿using UnityEngine;
using System.Collections;
using BehaviorDesigner.Runtime;
using BehaviorDesigner.Runtime.Tasks;

public class IsHasFlag : Conditional {

	private Offense offense;

	public override void OnAwake ()
	{
		offense = this.GetComponent<Offense>();
	}

	public override TaskStatus OnUpdate ()
	{
		if(offense == null){
			return TaskStatus.Failure;
		}

		if(offense.hasFlag){
			return TaskStatus.Success;
		}

		return TaskStatus.Failure;
	}
}
